import {createPinia} from "pinia";
import {createPersistedState} from 'pinia-plugin-persistedstate'
import init from './init.js'

const pinia = createPinia()
pinia.use(createPersistedState({
    storage: sessionStorage,
    key: id => `${import.meta.env.ENV_PINIA_KEY}${id}`,
}))
export const resetPinia = () => {
    pinia.state.value = JSON.parse(JSON.stringify(init))
}
resetPinia()
export default pinia